package com.qf.spring.ioc.service.impl;


import com.qf.spring.ioc.dao.UserDao;
import com.qf.spring.ioc.entity.User;
import com.qf.spring.ioc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    public User login(String userName, String password) throws RuntimeException {
        //todo
        //根据用户名数据库查询用户
        User user = userDao.selectUserByName(userName);
        if (null == user) {
            //todo 用户不存在，抛出异常
            return new User("jerry", "123456");
        }
        return null;
    }

    public void logout(Long userId) {

    }
}
